]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
main: Move g_setenv() calls before calls that may start threads
authorSebastian Keller <skeller@gnome.org>
Wed, 15 Nov 2023 09:21:35 +0000 (10:21 +0100)
committerSebastian Keller <skeller@gnome.org>
Wed, 15 Nov 2023 09:21:35 +0000 (10:21 +0100)
setenv() is not thread-safe and must happen before starting threads. The
g_setenv() calls in main() happened after meta_context_configure(),
which will start a thread via meta_profiler_new() which in its init
calls g_bus_get().

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6974
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3018>

src/main.c

index dec0efa8c82be027f637e7ab9db210f40c404279..10b5f6eb0f8a453d81e0283e4a112e9a7ef54928 100644 (file)
@@ -618,6 +618,12 @@ main (int argc, char **argv)
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
 
+  /* FIXME: Add gjs API to set this stuff and don't depend on the
+   * environment.  These propagate to child processes.
+   */
+  g_setenv ("GJS_DEBUG_OUTPUT", "stderr", TRUE);
+  g_setenv ("GJS_DEBUG_TOPICS", "JS ERROR;JS LOG", TRUE);
+
   context = meta_create_context (WM_NAME);
   meta_context_add_option_entries (context, gnome_shell_options,
                                    GETTEXT_PACKAGE);
@@ -641,12 +647,6 @@ main (int argc, char **argv)
   if (session_mode == NULL)
     session_mode = is_gdm_mode ? (char *)"gdm" : (char *)"user";
 
-  /* FIXME: Add gjs API to set this stuff and don't depend on the
-   * environment.  These propagate to child processes.
-   */
-  g_setenv ("GJS_DEBUG_OUTPUT", "stderr", TRUE);
-  g_setenv ("GJS_DEBUG_TOPICS", "JS ERROR;JS LOG", TRUE);
-
   dump_gjs_stack_on_signal (SIGABRT);
   dump_gjs_stack_on_signal (SIGFPE);
   dump_gjs_stack_on_signal (SIGIOT);